<?
class Tabs
{
	var $field="filter";
	var $query_string;
	var $items=Array();
	var $ajax=true;
	
	function Add($value,$title)
	{
		$tmp = Array();
		$tmp["title"]=$title;
		$tmp["url"]=LinkBuilder($this->field."=".$value."&page=&parent=&rand=");
		$tmp["active"]=($_REQUEST[$this->field]==$value);
		$this->items[]=$tmp;
	}
	
	function Render()
	{
		$dao = Array();
		$dao["title"] = $this->title;
		$dao["tabs"] = $this->items;
		$dao["ajax"] = ($this->ajax?"onclick='return alist(this.href)'":"");
		$dao["filter"] = $_REQUEST[$this->field];
		return TemplaterParse(GetAdminTemplate("tabs"),$dao);
	}
}